import request from '../../utils/request'

/**
 * 按条件查询列表
 *
 * @param source
 * @param target
 * @param page
 */
export async function queryCurrencyRate({ source, target, page }) {
	return request(apiPath.mc + "/api/currencyRate", {
		method: 'get',
		data: { source, target, page: page.page, size: page.size }
	});
}

/**
 * 根据id获取汇率
 *
 * @param id
 */
export async function getCurrencyRate({ id }) {
	return request(apiPath.mc + "/api/currencyRate/" + id, {
		method: 'get'
	});
}

/**
 * 新增外汇
 *
 * @param data
 */
export async function addCurrencyRate(data) {
	return request(apiPath.mc + "/api/currencyRate", {
		method: 'post',
		data
	});
}

/**
 * 更新外汇
 *
 * @param data
 */
export async function updateCurrencyRate(data) {
	return request(apiPath.mc + "/api/currencyRate", {
		method: 'put',
		data
	});
}


/**
 * 删除外汇
 *
 * @param id
 */
export async function deleteCurrencyRate({ id }) {
	return request(apiPath.mc + "/api/currencyRate/" + id, {
		method: 'delete'
	});
}

/**
 * 币种汇率转人民币
 *
 * @param currency
 */
export async function getCnyByCurrent({ currency }) {
	return request(apiPath.mc + "/api/getCnyByCurrency", {
		method: 'get',
		data: { currency }
	});
}